home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 42 / Amiga Format AFCD42 (Issue 126, Aug 1999).iso / -serious- / programming / other / ioblixdevkit / c / include / resources / ioblix.h
Encoding:
C/C++ Source or Header  |  1999-05-14  |  13.9 KB  |  262 lines

  1. /*
  2. **      $VER: resources/ioblix.h 37.3 (7.4.99)
  3. **
  4. **      (C) Copyright 1998,1999 Thore Böckelmann
  5. **      All Rights Reserved.
  6. */
  7.  
  8. #ifndef RESOURCES_IOBLIX_H
  9. #define RESOURCES_IOBLIX_H 1
  10.  
  11. #ifndef EXEC_TYPES_H
  12. #include <exec/types.h>
  13. #endif
  14.  
  15. #ifndef EXEC_NODES_H
  16. #include <exec/nodes.h>
  17. #endif
  18.  
  19. #ifndef EXEC_LISTS_H
  20. #include <exec/lists.h>
  21. #endif
  22.  
  23. #ifndef EXEC_LIBRARIES_H
  24. #include <exec/libraries.h>
  25. #endif
  26.  
  27. #ifndef EXEC_SEMAPHORES_H
  28. #include <exec/semaphores.h>
  29. #endif
  30.  
  31. #ifndef EXEC_INTERRUPTS_H
  32. #include <exec/interrupts.h>
  33. #endif
  34.  
  35. #ifndef PREFS_SERIAL_H
  36. #include <prefs/serial.h>
  37. #endif
  38.  
  39. #define IOBLIXRESNAME               "ioblix.resource"
  40.  
  41. /* manufacturer and product IDs for RBM products */
  42. #define RBM_MANUF_ID                4711    /* manufacturer ID of RBM Digitaltechnik    */
  43. #define IOBLIX_Z2_PROD_ID           1       /* board ID of ZorroII IOBlix board         */
  44. #define IOBLIX_1200_SER_PROD_ID     2       /* board ID of IOBlix1200 ser module        */
  45. #define IOBLIX_1200_PAR_PROD_ID     3       /* board ID of IOBlix1200 par module        */
  46.  
  47. /* how many boards can exist */
  48. #define IOBLIX_MAX_Z2_BOARDS        5
  49. #define IOBLIX_MAX_CP_BOARDS        1
  50.  
  51. /* how many units of which type can exist */
  52. #define IOBLIX_Z2_NUM_SERUNITS      4       /* max. serial ports on Z2 board            */
  53. #define IOBLIX_Z2_NUM_PARUNITS      2       /* max. parallel ports on Z2 board          */
  54. #define IOBLIX_Z2_NUM_FIFOUNITS     1       /* max. ext. fifos on Z2 board              */
  55. #define IOBLIX_Z2_NUM_ETHERUNITS    1       /* max. EtherNet modules on Z2 board        */
  56. #define IOBLIX_Z2_NUM_AUDIOUNITS    1       /* max. Audio modules on Z2 board           */
  57.  
  58. #define IOBLIX_CP_NUM_SERUNITS      4       /* max. ser ports on clock port board       */
  59. #define IOBLIX_CP_NUM_PARUNITS      4       /* max. par ports on clock port board       */
  60. #define IOBLIX_CP_NUM_FIFOUNITS     0       /* max. fifos on clock port board           */
  61. #define IOBLIX_CP_NUM_ETHERUNITS    0       /* max. EtherNets on clock port board       */
  62. #define IOBLIX_CP_NUM_AUDIOUNITS    0       /* max. Audio modules on clock port board   */
  63.  
  64. /* the central resource */
  65. struct IOBlixResource {
  66.     struct Library ir_Library;
  67.     struct ExecBase *ir_SysBase;
  68.     /* private data follows, hands off! */
  69. };
  70.  
  71. struct IOBlixBoardNode {
  72.     struct Node ibn_Node;                   /* link                                     */
  73.     struct ConfigDev *ibn_Board;            /* ConigDev structure as returned by        */
  74.                                             /* expansion/FindConfigDev()                */
  75.     UWORD ibn_Type;                         /* Z2, clock port, etc                      */
  76.     UWORD ibn_Number;                       /* internal board number                    */
  77. };
  78.  
  79. /* IOBlixBoardNode.ibn_Type */
  80. #define IBT_ZORRO2                  1       /* ZorroII board                            */
  81. #define IBT_CP_SERIAL               2       /* clock port serial module                 */
  82. #define IBT_CP_PARALLEL             3       /* clock port parallel module               */
  83.  
  84. /* common structure for chip's register addresses */
  85. struct ChipRegs {
  86.     ULONG cr_RegCount;                      /* number of register addresses following   */
  87.     APTR cr_Regs[1];                        /* dummy array of register addresses        */
  88.                                             /* cr_RegCount pointers follow              */
  89. };
  90.  
  91. struct IOBlixPnPInfo {
  92.     UBYTE pnp_SerialIdentifier[32];         /* serial identifiert read during PnP       */
  93.     UBYTE pnp_DeviceIdent[8];
  94.     ULONG pnp_DeviceSerNo;
  95.     APTR pnp_AddressAddr;                   /* address register address                 */
  96.     APTR pnp_WriteAddr;                     /* write register address                   */
  97.     APTR pnp_ReadAddr;                      /* read register address                    */
  98.     ULONG pnp_CardSelectNumber;             /* PnP device number (CSN)                  */
  99.     ULONG pnp_LogicalDeviceNumber;          /* logical device number of this chip       */
  100.     APTR pnp_Reserved[4];
  101. };
  102.  
  103. /* IOBlixChipNode, returned by FindChip() and ObtainChip */
  104. /* all fields are READ-ONLY! */
  105. struct IOBlixChipNode {
  106.     struct Node icn_Node;                   /* link                                     */
  107.     ULONG  icn_Flags;                       /* flags                                    */
  108.     UWORD  icn_Type;                        /* chip type (ser, par, etc)                */
  109.     UWORD  icn_Number;                      /* chip's internal number                   */
  110.                                             /* equals unit number of devices            */
  111.     struct ChipRegs *icn_ChipRegisters;     /* array of pointers to chips registers     */
  112.                                             /* ie a pointer to (struct UARTRegisters *) */
  113.                                             /* the old icn_Address entry is obsolete    */
  114.     UBYTE  icn_Description[256];            /* name, information, etc                   */
  115.     UBYTE *icn_Owner;                       /* current owner name, or NULL if none      */
  116.     struct IOBlixBoardNode *icn_Board;      /* board to which the chip belongs to       */
  117.     LONG   icn_ExpanderPort;                /* cp port, if used with cp expander        */
  118.                                             /* -1 for Z2 boards                         */
  119.                                             /* 0..3 for clockport modules               */
  120.     struct SignalSemaphore icn_SharedAccessSema;
  121.                                             /* semaphore for shared chip access         */
  122.                                             /* you MUST obtain this if you want to      */
  123.                                             /* access the chip in shared mode to avoid  */
  124.                                             /* crashes                                  */
  125.     struct List icn_SharedAccessorList;     /* list of shared accessors                 */
  126.     ULONG  icn_SharedAccessorCount;         /* counter for shared accesses              */
  127.     union {
  128.         struct SerialChipProperties {
  129.             ULONG scp_UARTType;             /* serial UART type                         */
  130.             ULONG scp_FIFOSize;             /* UART's fifo size                         */
  131.             ULONG scp_Flags;                /* flags                                    */
  132.             ULONG scp_Frequency;            /* oscillator frequency                     */
  133.             struct SerialPrefs scp_Prefs;   /* baud, handshake, etc                     */
  134.         } icn_SerialProperties;
  135.         struct ParallelChipProperties {
  136.             ULONG pcp_Abilities;            /* parport ability mask                     */
  137.             ULONG pcp_FIFOSize;             /* parallel fifo size                       */
  138.             ULONG pcp_WriteThresh;          /* irq threshold on write                   */
  139.             ULONG pcp_ReadThresh;           /* irq threshold on read                    */
  140.         } icn_ParallelProperties;
  141.         struct ExternalFIFOProperties {
  142.             BOOL efp_Installed;
  143.             BOOL efp_Operable;
  144.             ULONG efp_WriteFIFOSize;
  145.             ULONG efp_WriteHalfFullSize;
  146.             ULONG efp_ReadFIFOSize;
  147.             ULONG efp_ReadHalfFullSize;
  148.         } icn_ExternalFIFOProperties;
  149.         struct AudioChipProperties {
  150.             struct IOBlixPnPInfo acp_PnPInfo;
  151.         } icn_AudioChipProperties;
  152.     } icn_Properties;
  153. };
  154.  
  155. #define icns_UARTType               icn_Properties.icn_SerialProperties.scp_UARTType
  156. #define icns_FIFOSize               icn_Properties.icn_SerialProperties.scp_FIFOSize
  157. #define icns_Flags                  icn_Properties.icn_SerialProperties.scp_Flags
  158. #define icns_Frequency              icn_Properties.icn_SerialProperties.scp_Frequency
  159. #define icns_Prefs                  icn_Properties.icn_SerialProperties.scp_Prefs
  160. #define icnp_Abilities              icn_Properties.icn_ParallelProperties.pcp_Abilities
  161. #define icnp_FIFOSize               icn_Properties.icn_ParallelProperties.pcp_FIFOSize
  162. #define icnp_WriteThresh            icn_Properties.icn_ParallelProperties.pcp_WriteThresh
  163. #define icnp_ReadThresh             icn_Properties.icn_ParallelProperties.pcp_ReadThresh
  164. #define icnf_StatusReg              icn_Properties.icn_ExternalFIFOProperties.efp_StatusReg
  165. #define icnf_Installed              icn_Properties.icn_ExternalFIFOProperties.efp_Installed
  166. #define icnf_Operable               icn_Properties.icn_ExternalFIFOProperties.efp_Operable
  167. #define icnf_WriteFIFOSize          icn_Properties.icn_ExternalFIFOProperties.efp_WriteFIFOSize
  168. #define icnf_WriteHalfFullSize      icn_Properties.icn_ExternalFIFOProperties.efp_WriteHalfFullSize
  169. #define icnf_ReadFIFOSize           icn_Properties.icn_ExternalFIFOProperties.efp_ReadFIFOSize
  170. #define icnf_ReadHalfFullSize       icn_Properties.icn_ExternalFIFOProperties.efp_ReadHalfFullSize
  171. #define icna_PnPInfo                icn_Properties.icn_AudioChipProperties.acp_PnPInfo
  172.  
  173. /* icn_Flags */
  174. #define ICFB_SHARED                 0       /* chip is obtained in shared mode          */
  175. #define ICFF_SHARED                 (1 << ICFB_SHARED)
  176.  
  177. /* icn_Type */
  178. #define ICT_NO_CHIP                 0       /* just a dummy                             */
  179. #define ICT_Z2_SERIAL_CHIP          1       /* UART on a ZorroII board                  */
  180. #define ICT_Z2_PARALLEL_CHIP        2       /* ParPort on a ZorroII board               */
  181. #define ICT_Z2_EXTFIFO_CHIP         3       /* FIFO on a ZorroII board                  */
  182. #define ICT_Z2_ETHERNET_CHIP        4       /* EtherNet chip on a ZorroII board         */
  183. #define ICT_Z2_AUDIO_SBPRO_CHIP     5       /* SoundBlaster                             */
  184. #define ICT_Z2_AUDIO_ADLIB_CHIP     6       /* AdLib                                    */
  185. #define ICT_Z2_AUDIO_SSD_CHIP       7       /* SoundSystemDirect                        */
  186. #define ICT_Z2_AUDIO_MIDI_CHIP      8       /* MIDI                                     */
  187. #define ICT_Z2_AUDIO_GAMEPORT_CHIP  9       /* GamePort                                 */
  188. #define ICT_CP_SERIAL_CHIP          101     /* UART on a clock port module              */
  189. #define ICT_CP_PARALLEL_CHIP        102     /* ParPort on a clock port module           */
  190.  
  191. /* scp_UARTType */
  192. #define SCPT_UNKNOWN                0       /* unknown UART                             */
  193. #define SCPT_8250                   1       /* CIA 8250                                 */
  194. #define SCPT_16450                  2       /* 16C450                                   */
  195. #define SCPT_16550                  3       /* 16C550                                   */
  196. #define SCPT_16550A                 4       /* 16C550A                                  */
  197. #define SCPT_CIRRUS                 5       /* Cirrus                                   */
  198. #define SCPT_16650                  6       /* 16C650                                   */
  199. #define SCPT_16650V2                7       /* 16C650 V2                                */
  200. #define SCPT_16654                  8       /* 16C654                                   */
  201. #define SCPT_16750                  9       /* 16C750                                   */
  202. #define SCPT_STARTECH               10      /* StarTech                                 */
  203. #define SCPT_MAX                    10
  204.  
  205. /* scp_Flags */
  206. #define SCPFB_USE_FIFO              0       /* enable FIFO                              */
  207. #define SCPFF_USE_FIFO              (1 << SCPFB_USE_FIFO)
  208. #define SCPFB_CLEAR_FIFO            1       /* clear FIFO on use                        */
  209. #define SCPFF_CLEAR_FIFO            (1 << SCPFB_CLEAR_FIFO)
  210. #define SCPFB_STARTECH              2       /* enable StarTech features                 */
  211. #define SCPFF_STARTECH              (1 << SCPFB_STARTECH)
  212. /* pcp_Abilities */
  213. /* simple parallel port */
  214. #define PCPAB_SPP                   0
  215. #define PCPAF_SPP                   (1 << PCPAB_SPP)
  216. /* parallel port with fifo */
  217. #define PCPAB_PPF                   1
  218. #define PCPAF_PPF                   (1 << PCPAB_PPF)
  219. /* PS/2 mode supported */
  220. #define PCPAB_PS2                   2
  221. #define PCPAF_PS2                   (1 << PCPAB_PS2)
  222. /* EPP mode supported */
  223. #define PCPAB_EPP                   3
  224. #define PCPAF_EPP                   (1 << PCPAB_EPP)
  225. /* ECP mode supported */
  226. #define PCPAB_ECP                   4
  227. #define PCPAF_ECP                   (1 << PCPAB_ECP)
  228. /* ECR register available */
  229. #define PCPAB_ECR                   5
  230. #define PCPAF_ECR                   (1 << PCPAB_ECR)
  231. /* ECP/PS2 mode supported */
  232. #define PCPAB_ECP_PS2               6
  233. #define PCPAF_ECP_PS2               (1 << PCPAB_ECP_PS2)
  234. /* ECP/EPP mode supported */
  235. #define PCPAB_ECP_EPP               7
  236. #define PCPAF_ECP_EPP               (1 << PCPAB_ECP_EPP)
  237. /* IEEE1284 compatible */
  238. #define PCPAB_IEEE1284              8
  239. #define PCPAF_IEEE1284              (1 << PCPAB_IEEE1284)
  240. /* port is completely dead */
  241. #define PCPAB_NOT_WORKING           31
  242. #define PCPAF_NOT_WORKING           (1 << PCPAB_NOT_WORKING)
  243.  
  244. /* Interrupt Hooks                                                                      */
  245. /* To be able to recognize all interrupts, that can happen on an IOBlix board, it is    */
  246. /* necessary to hook into IOBlix' own interrupt chain. Your node will be enqueued       */
  247. /* and called dependant of its priority.                                                */
  248. /* This structure must be filled with all necessary data to be called within an         */
  249. /* interrupt.                                                                           */
  250. /* Especially ihn_Node.ln_Pri should be initialized with a suitable value               */
  251.  
  252. struct IRQHookNode {
  253.     struct Node ihn_Node;                   /*                                          */
  254.     ULONG (*ihn_HookFunc)( APTR userData ); /* the function, that is to be called when  */
  255.                                             /* an interrupt occurs                      */
  256.     APTR ihn_HookUserData;                  /* any data you want to be passed to your   */
  257.                                             /* function. Data is passed on the stack!   */
  258. };
  259.  
  260. #endif /* RESOURCES_IOBLIX_H */
  261.  
  262.